<template>
	<view class="content">
		<view class="cont">
			<navigator class="cbox" hover-class="none" url="help">
				<view class="dis-flex">
					<i class="iconfont iconbangzhuzhongxin"></i>
					<view class="item-text">智助中心</view>
				</view>
				<i class="iconfont iconjiantou"></i>
			</navigator>
			<navigator class="cbox" hover-class="none" url="./sub-setting/feedback">
				<view class="dis-flex">
					<i class="iconfont iconyijianfankui"></i>
					<view class="item-text">意见反馈</view>
				</view>
				<i class="iconfont iconjiantou"></i>
			</navigator>
			<navigator class="cbox" hover-class="none" url="publicity">
				<view class="dis-flex">
					<i class="iconfont icongongshi1_huaban1"></i>
					<view class="item-text">退费公示</view>
				</view>
				<i class="iconfont iconjiantou"></i>
			</navigator>
		</view>

		<view class="cont">
			<view class="cbox" @click="outclick(0)">
				<view class="dis-flex">
					<i class="iconfont iconqiehuan"></i>
					<view class="item-text">切换账号</view>
				</view>
				<i class="iconfont iconjiantou"></i>
			</view>
			<navigator class="cbox" hover-class="none" url="./sub-setting/edit-password">
				<view class="dis-flex">
					<i class="iconfont iconmima"></i>
					<view class="item-text">修改密码</view>
				</view>
				<i class="iconfont iconjiantou"></i>
			</navigator>
		</view>

		<view class="cont">
			<navigator class="cbox" hover-class="none" url="team">
				<view class="dis-flex">
					<i class="iconfont iconchengyuanliebiao1"></i>
					<view class="item-text">师资力量</view>
				</view>
				<i class="iconfont iconjiantou"></i>
			</navigator>
			<navigator class="cbox" hover-class="none" url="/pages/mine/systemSetting">
				<view class="dis-flex">
					<i class="iconfont iconshezhi"></i>
					<view class="item-text">系统设置</view>
				</view>
				<i class="iconfont iconjiantou"></i>
			</navigator>
			<navigator class="cbox" hover-class="none" url="../update/index">
				<view class="dis-flex">
					<i class="iconfont iconshengji"></i>
					<view class="item-text">版本说明</view>
					<view class="new-tips" v-if="newUpdate">有新版本</view>
				</view>
				<view class="edition-text">当前版本:<text>{{ version }}</text></view>
				<i class="iconfont iconjiantou"></i>
			</navigator>
		</view>

		<view class="cont">
			<view class="cbox" @click="outclick(1)">
				<view class="dis-flex">
					<i class="iconfont icontuichudenglu"></i>
					<view class="item-text">退出登录</view>
				</view>
				<i class="iconfont iconjiantou"></i>
			</view>
		</view>
		<update-mobel :showTips="showTips" :showNewed="showNewed" ref="isShow"></update-mobel>
	</view>
</template>

<script>
	import updateMobel from '@/components/updateMobel.vue';
	var _this;
	export default {
		components: {
			updateMobel
		},
		data() {
			_this = this;
			return {
				version: '', //plus.runtime.version
				newUpdate: false,
				show4: false,
				showTips: false, // 控制显示 提示框 默认为false 不显示
				showNewed: false // 控制显示 已经是最新版本 提示框 默
			};
		},
		onLoad: function() {
			plus.runtime.getProperty(plus.runtime.appid, function(inf) {
				//wgtVer = inf.version;
				_this.version = inf.version;
				//console.log('当前应用版本：' + wgtVer);
			});
		},
		methods: {
			// 跳转 0为切换账号 || 1为退出登录
			outclick(type) {
				var txt = '确认退出登录？';
				if(type == 0) {
					txt = '确认切换账号？';
				}
				uni.showModal({
					content: txt,
					cancelText: '取消',
					confirmText: '确认',
					success: function(res) {
						if (res.confirm) {
							var phone = uni.getStorageSync('phone');
							var password = uni.getStorageSync('password');
							_this.$zapi.apiPost('user/currency.basic/UserLoginOut').then(res => {
								return
							})
							// uni.clearStorageSync();
							// uni.setStorageSync('phone', phone);
							// uni.setStorageSync('password',password);
							uni.removeStorageSync('token');
							uni.removeStorageSync('atoken');
							uni.removeStorageSync('currentChild')
							if (type == 0) {
								uni.clearStorageSync();
							}
							uni.reLaunch({
								url: '../user/login'
							});
						}
					}
				});
			}
		}
	};
</script>

<style>
	page {
		background-color: #F3F3F3;
	}

	.cont {
		background-color: #FFFFFF;
		margin-bottom: 20upx;
	}

	.cbox {
		display: flex;
		justify-content: space-between;
		align-items: center;
		height: 110upx;
		margin: 0 30upx;
		width: calc(100% - 60upx);
		border-bottom: 2upx solid #F3F3F3;
	}

	.cont .cbox:last-child {
		border-bottom: none;
	}

	.dis-flex {
		display: flex;
		justify-content: flex-start;
		align-items: center;
	}

	.cbox i {
		width: 50upx;
		font-size: 46upx;
		text-align: center;
		margin-right: 20upx;
	}

	.dis-flex .item-text {
		color: #333333;
		font-size: 32upx;
	}

	.iconjiantou {
		color: #999999;
		margin: 0 !important;
	}

	.iconbangzhuzhongxin,
	.iconyijianfankui,
	.icongongshi1_huaban1,
	.iconqiehuan,
	.iconmima {
		color: #FF9900;
	}

	.iconchengyuanliebiao1,
	.iconshezhi,
	.iconshengji,
	.icontuichudenglu {
		color: #00ACFE;
	}

	.icongongshi1_huaban1,
	.iconchengyuanliebiao1 {
		font-size: 52upx;
	}

	.new-tips {
		width: 120upx;
		height: 40upx;
		font-size: 24upx;
		background: #00ACFE;
		color: #FFFFFF;
		margin-left: 46upx;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.edition-text {
		color: #999999;
		font-size: 24upx;
		margin-left: 37upx;
	}
</style>
